package cn.mldn.experiment.threadOfProducerAndConsumer;

public class Message
{
	private String title; // 保存信息的标题
	private String content; // 保存信息的内容

	public synchronized void set(String title, String content)
	{
		this.title = title;
		try
		{
			Thread.sleep(200);
		} catch (InterruptedException e)
		{
			e.printStackTrace();
		}
		this.content = content;
	}

	public synchronized String get()
	{
		try
		{
			Thread.sleep(100);
		} catch (InterruptedException e)
		{
			e.printStackTrace();
		}
		return this.title + " --> " + this.content;
	}

}
